<template>
  <el-col :span="20" class="desc">
    <el-form label-width="120px">
      <el-form-item label="线下支付提示页">
        <editor v-model="editorContent" v-if="editorShow"></editor>
      </el-form-item>
    </el-form>
    <el-col :span="24" type="flex" justify="center" align="middle">
      <el-button type="primary" style="width:30%" @click="setOfflinePayContent">提交</el-button>
    </el-col>
  </el-col>
</template>

<script>
import editor from '@/components/editor'
export default {
  data() {
    return {
      title: '',
      editorContent: '',
      disabled: false,
      editorShow: false,
    };
  },
  components:{
    editor
  },
  created(){
    this.getOfflinePayContent();
  },
  methods: {
    //获取
    async getOfflinePayContent(){
      const res = await this.$api.getOfflinePayContent();
      if(res.data.level=='success'){
        this.editorContent = res.data.data.content;
      }else{
        this.$message({
          message: res.data.message,
          type: 'warning'
        });
      }
      setTimeout(()=>{
        this.editorShow = true;
      },500)
    },
    //编辑提交
    async setOfflinePayContent(){
      const params = {
        content:this.editorContent,
      }
      const res = await this.$api.setOfflinePayContent(params);
      if(res.data.level=='success'){
				this.$message({
          message: '修改成功',
          type: 'success'
        });
      }else{
        this.$message({
          message: res.data.message,
          type: 'warning'
        });
      }
    },
  }
}
</script>
<style lang='scss' scoped>

</style>